<?php session_start(); ?>

<?php
include "Connect.php";

$kitchen = trim($_POST['kitchen']);
$pos = trim($_POST['pos']);

$regApp = $_POST['regApp'];

if(isset($regApp)){

if($kitchen == "" || $pos == ""){
//$msg = "Please provide both felds!!"; 
//header("location:adminPage.php?poll=$msg");

$_SESSION['mande'] = "Please provide both felds!!";

//$_SESSION['mande'] = "";
$_SESSION['xx'] = "";

//$_SESSION['man'] ="";
include "dataColl.php";
//maintain();
}else{

if($kitchen == $pos){

$_SESSION['mande'] = "Kitchen and POS cannot have the same name!!";

//$_SESSION['mande'] = "";

$_SESSION['xx'] = "";

//maintain();
include "dataColl.php";

}else{

$g1 = mysql_query("UPDATE application SET AddressName = '$kitchen' WHERE ID = 1") or die(mysql_error());
$g2 = mysql_query("UPDATE application SET AddressName = '$pos' WHERE ID = 2") or die(mysql_error());

if($g1 and $g2){

$_SESSION['mande'] = "Kitchen and POS registered successfully!!"; 

//$_SESSION['man'] = "";

$_SESSION['xx'] = "";

//maintain();
include "dataColl.php";

}else{

$_SESSION['mande'] = "Registration failed!!";

$_SESSION['xx'] = "";

//maintain();
include "dataColl.php";

 }

  }
    }
	
  }
/*	
function maintain(){

if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1; 

$_SESSION['mG'] = 1;

//$_SESSION['xx'] = "Please provide both felds!!";

$max_results = 4;

$from = (($page * $max_results) - $max_results);
 
$getStuff = mysql_query("SELECT * FROM processedorder LIMIT $from, $max_results") or die(mysql_error());
include "dataColl.php";

}
*/
?>